<template>
  <div class="m-date-picker">
    <date-picker v-bind="$attrs" v-on="$listeners" :style="{ width: width + 'px' }" :format="format" :value-format="valueFormat" />
  </div>
</template>

<script>
import { DatePicker } from 'element-ui'

export default {
  name: 'MDatePicker',
  components: { DatePicker },
  props: {
    width: String,
		format:{
			type: String,
			default: "yyyy 年 MM 月 dd 日"
		},
		valueFormat:{
			type: String,
			default: "timestamp"
		}
  }
}
</script>

<style lang="scss">
.el-date-picker__header {
  .el-date-picker__header-label:hover, button:hover {
    color: #E48B2C;
    font-weight: bold;
  }
}

.el-date-table, .el-year-table, .el-month-table {
  td.available.current {
    span {
      background-color: #E48B2C;
    }
  }

  td.available:not(.current):hover {
    a, span {
      color: #E48B2C;
    }
  }

  td.available.today {
    a, span {
      color: #E48B2C;
    }
  }

  &.el-month-table {
    a:hover {
      color: #E48B2C !important;
    }

    td.today {
      a {
        color: #E48B2C !important;
      }
    }
  }
}
</style>

<style lang="scss" scoped>
@import "~@/assets/style/common.scss";

.m-date-picker {
  /deep/ .el-input__inner, /deep/ .el-textarea__inner {
    background-color: #F3F4F8;
    border-radius: 10px;
    border-color: #e9e9e9;
  }

  /deep/ .el-input__inner:focus {
    border-color: $theme-color-1;
  }

  /deep/.el-input--prefix {
    position: relative;

    .el-input__prefix {
      width: 40px;
      height: 40px;
      left: calc(100% + 8px);
      background: #F3F3F7;
      border: 1px solid #E9E9E9;
      border-radius: 10px;

      .el-icon-date {
        display: block;
        width: 24px;
        height: 24px;
        margin: 7px;
        background: url('~@/views/require/images/date.png') no-repeat;

        &:before {
          content: '';
        }
      }
    }
  }
}
</style>
